package com.controller.front;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.service.front.IMusicListFrontService;
@RequestMapping("/front")
@Controller
public class MusicListFrontController {

	@Autowired
	private IMusicListFrontService iMusicList1Service;
	//查询所有歌单内容
	@RequestMapping("/musicList_list")
	public String song_list(Model model){
		List<Map<String, Object>> songList = iMusicList1Service.list();
		model.addAttribute("songList", songList);
		return "songs";
	}
	
	//根据歌单id来查询数据
	@RequestMapping("/songs_list1")
	public String songs_list1(Model model,int musicId,String musicListName){
		Map<String, Object> musicMap = iMusicList1Service.findBymid(musicId);		
		model.addAttribute("music", musicMap);
		
		//根据歌手名查询
		List<Map<String,Object>> findmusicListName = iMusicList1Service.findBymName(musicListName);
    	model.addAttribute("findmusicListName", findmusicListName);
		return "songsList";
	}
	
}
